package com.leejxx.health.mobile.controller;

import com.leejxx.health.common.MessageConst;
import com.leejxx.health.entity.Result;
import com.leejxx.health.pojo.Setmeal;
import com.leejxx.health.service.CheckMealService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author LeeJx
 * @ClassName SetMealController
 * @Description TODO
 * @date 2021/1/4 20:57
 * @Version 1.0
 */
@RestController
@Slf4j
@RequestMapping("/mobile/setMeal")
public class SetMealController {

    @DubboReference
    private CheckMealService checkMealService;

    @RequestMapping("/getSetMeal")
    public Result getSetMeal() {
        List<Setmeal> checkMeals = checkMealService.findAllCheckMeal();
        log.info("[移动端套餐管理-查询套餐列表]data:{}", checkMeals);
        return new Result(true, MessageConst.QUERY_SETMEALLIST_SUCCESS, checkMeals);
    }

    @RequestMapping("/findById")
    public Result findById(Integer id) {
        log.info("[移动端套餐管理-查询套餐细节]id:{}", id);
        Setmeal checkMeal = checkMealService.findById(id);
        return new Result(true, MessageConst.QUERY_SETMEALLIST_SUCCESS, checkMeal);
    }
}
